sudo apt-get -y install g++
sudo apt-get -y install libgl1-mesa-dev
sudo apt-get install -y libqwt-qt5-dev
sudo apt-get -y install build-essential
wget https://download.qt.io/archive/qt/5.14/5.14.0/qt-opensource-linux-x64-5.14.0.run
chmod u+x qt-opensource-linux-x64-5.12.1.run
sudo ./qt-opensource-linux-x64-5.12.1.run  #此步需要x11转发 或者在desktop版打开
# 安装的时候全选就行，就那点硬盘也无所谓了

# export PATH=/home/`whoami`/Qt5.12.1/5.12.1/gcc_64/bin/bin:$PATH 

####         mysql 安装配置远程连接

# 下载安装
sudo apt-get install mysql-server mysql-client
# sudo systemctl status mysql # 验证

#修改mysql的密码
sudo mysql
SET GLOBAL validate_password.policy=LOW # 让密码可以设置的简单一点， 自己玩玩的数据库密码简单点无所谓的
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'passwd';
FLUSH PRIVILEGES;
#修改root能让外部主机访问
UPDATE mysql.user SET HOST='%' WHERE User='root';
FLUSH PRIVILEGES;

#
sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
# 将里面的 即注释 bind-address = 127.0.0.1
#   bind-address = 127.0.0.1 to: 
#   #bind-address = 127.0.0.1 
sudo apt-get install libqt5sql5-mysql

sudo /etc/init.d/mysql restart

# mysql
sudo apt-get install libmysqlclient-dev
# qt-library-mysql-is-not-defined

# Just for making my snippet work. Feel free to hardcode paths.
export QTDIR=/home/you/Qt/
export QTVERSION=5.9.5

cd $QTDIR/$QTVERSION/Src/qtbase/src/plugins/sqldrivers
$QTDIR/$QTVERSION/gcc_64/bin/qmake sqldrivers.pro
cd mysql
make
make install # if you want; it installs it in the bin dir of $QTVERSION